#include "Car.h"
#include <cstring>
#include <iostream>
using namespace std;
#include <cstdlib>

#define SIZE 20

Car::Car(int _wheelCount, const char* _brand, double _price, const char* _color)
	:wheelCount(_wheelCount),
	price(_price)
{	
	//brand = _brand;
	//color = _color;
	brand = (char*)malloc(sizeof(char) * SIZE);
	strcpy(brand, _brand);
	color = (char*)malloc(sizeof(char) * SIZE);
	strcpy(color, _color);
}

Car::~Car()
{
	if(brand)		free(brand);
	if(color)		free(color);
	cout << "~Car()" << endl;
}

void Car::setWheelCount(int _wheelCount)
{
	wheelCount = _wheelCount;
}

int Car::getWheelCount()
{
	return wheelCount;
}

void Car::setBrand(const char* _brand)
{
	strcpy(brand, _brand);
}

const char* Car::getBrand()
{
	return brand;
}

void Car::setPrice(double _price)
{
	price = _price;
}

double Car::getPrice()
{
	return price;
}


void Car::setColor(const char* _color)
{
	strcpy(color, _color);
}

const char* Car::getColor()
{
	return color;
}

void Car::sale()
{
	cout << "wheelCount: " << wheelCount << endl;
	cout << "brand: " << brand << endl;
	cout << "price: " << price << endl;
	cout << "color: " << color << endl;
}
